﻿<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>管理员账号激活</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript">
            function onBtnUpdate(sObj) {
            var obj = document.getElementById(sObj);
            $.ajax({
                url: "thj.asp",
                data: {
                    Action: "alter",
                    Field: sObj,
                    Value: obj.value
                },
                success: function(data) {
                    var oData = eval("(" + data + ");");
                    if (oData.msg == 'ok') {
                        window.location = "index.asp";
                    }
                    else if (oData.msg == "error") {
                        alert(oData.param);
                    }
                    else {
                        alert("未知问题！");
                    }
                }
            });
        }
        function onBtnPassUpdate(codename) {
            var obj1 = document.getElementById(codename+"password1");
            var obj2 = document.getElementById(codename+"password2");
            if (obj1.value != obj2.value) {
                alert("两次输入密码不一致！");
                return;
            }
            $.ajax({
                url: "thj.asp",
                data: {
                    Action: "alter",
                    Field: "ad_password",
                    Value: obj1.value,
                    Code:codename
                },
                success: function(data) {
                    var oData = eval("(" + data + ");");
                    if (oData.msg == 'ok') {
                        window.location = "index.asp";
                    }
                    else if (oData.msg == "error") {
                        alert(oData.param);
                    }
                    else {
                        alert("未知问题！");
                    }
                }
            });
        }
        function onBtnActive(codes) {
            $.ajax({
                url: "thj.asp",
                data: {
                    Action: "alter",
                    Field: "[state]",
                    Value: "active",
		    Code:codes
                },
                success: function(data) {
                    var oData = eval("(" + data + ");");
                    if (oData.msg == 'ok') {
			alert("激活成功！");
                        window.location = "index.asp";
                    }
                    else if (oData.msg == "error") {
                        alert(oData.param);
                    }
                    else {
                        alert("未知问题！");
                    }
                }
            });
        }
    </script>

    <script type="text/javascript" src="/js/jquery-1.10.2.min.js"></script>

    <link rel="stylesheet" type="text/css" href="" />
    <style type="text/css">
        .STYLE1
        {
            font-family: Arial, Helvetica, sans-serif;
        }
        .textinput
        {
            width: 256px;
        }
        .passinput
        {
            width: 124px;
        }
        .infocell
        {
            text-align: left;
        }
        .btn
        {
            width: 49px;
        }
        #sName
        {
            width: 300px;
        }
    </style>
</head>
<body>
    <div id="iframe">
        <%if isLogin=false then %>
        <%response.Redirect "index.asp" %>
        <%else %>
        <%
            dim kr,sql
            call createRst(kr)
			if adminLogin=true then
				sql="select * from s_admin"
			else
				sql="select * from s_admin where ad_code='" & Session("fix_usercode") & "'"
			end if
            kr.open sql,conn,3,3
                if kr.recordcount=0 then
                    response.Redirect "index.asp"
                else
                    
        %>
        <div align="center" class="STYLE1">
            <p>
                <b>管理员账号管理系统</b></p>
            <%
					do while not kr.eof = true
            %>
            <table width="400" border="1" cellspacing="0" cellpadding="0">
                <tr>
                    <th width="77" scope="col">
                        数据段
                    </th>
                    <th width="317" scope="col">
                        值
                    </th>
                </tr>
                <tr>
                    <td>
                        <div align="center">
                            姓名</div>
                    </td>
                    <td>
                        <div class="infocell">
                            <input type="text" id="sName" value="<%=kr("ad_name") %>" style="width: 96%" />&nbsp;
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div align="center">
                            编码</div>
                    </td>
                    <td>
                        <div class="infocell">
                            <input name="text" type="text" id="ad_code" readonly style="width: 96%" value="<%=kr("ad_code") %>" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div align="center">
                            密码</div>
                    </td>
                    <td>
                        <div class="infocell">
							<%if kr("ad_code")=Session("fix_usercode") then	%>
                            <input name="password" type="text" id="<%=kr("ad_code")%>password1" class="passinput" value="<%=kr("ad_password") %>" />
							<%else%>
							<input name="password" type="text" id="<%=kr("ad_code")%>password1" class="passinput" value="" />
							<%end if%>
                            <input name="password" type="text" id="<%=kr("ad_code")%>password2" class="passinput" value="" />
                            <input name="button2" type="button" id="button2" class="btn" onclick="return onBtnPassUpdate('<%=kr("ad_code")%>');"
                                value="更新" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div align="center">
                            联系方式</div>
                    </td>
                    <td>
                        <div class="infocell">
                            <input name="text3" type="text" id="ad_phone" class="textinput" value="<%=kr("ad_phone") %>" />
                            <input name="button3" type="button" id="button3" class="btn" onclick="return onBtnUpdate('ad_phone');"
                                value="更新" />
                        </div>
                    </td>
                </tr>
            </table>
            <p>
                &nbsp;
                <%if kr("state")="active" then%>
                <%else%>
                <input name="button4" type="button" id="button4" onclick="onBtnActive('<%=kr("ad_code")%>');"
                    value="激活账号" /></p>
            <%end if%>
            <p>
                &nbsp;</p>
            <%
			kr.movenext
			loop%>
        </div>
        <%      
        kr.close
        set kr=nothing
        end if %>
        <%end if %>
    </div>
</body>
</html>